import yz from "./yz.js"
// console.log(yz);
const install = (Vue, vm) => {
	vm.$u.utils = {
		/*验证码倒计时*/ 
		getCode(vm){vm.getCodeText = '59s';let num = 59;let tirm = setInterval(_ => {num--;vm.$set(vm,'getCodeText',`${num}s`);if (num <= 0) {num = 59;vm.getCodeText = `获取验证码`;clearInterval(tirm);}}, 1000)},
		// 验证
		yz,
		// 上传文件返回线上地址
		uploadFile(params){
			let httpUrl = vm.$u.http.config.baseUrl;
			return new Promise((resolve, reject)=>{
				uni.uploadFile({
					url:httpUrl+'/upload/up',
					name:'file',
					filePath:params,
					success:res=>{
						resolve(res.data)
					},
					file:err=>{
						reject(err)
					}
				})
			})
		},
	}
}
export default {
	install,
}
